<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title></title> 

</head>
<jsp:include page="../default.jsp" />
<body>
	<div class="mini-fit">
		<div id="form" align="center">
			<ul id="tree" class="mini-tree"
					url=""
					textField="name" idField="id" parentField="parentId"
					expandOnLoad="true" resultAsTree="false"
					showCheckBox="true" checkRecursive="false" autoCheckParent="true"
					onload="PageHelper.prototype.commonError">
			</ul>		
		</div>
	</div>
	<div class="mini-toolbar" style="text-align: center; border-bottom:0;border-left:0;border-right:0;">		
		<a class="mini-button" iconCls="icon-save" onclick="save()" id="saveBtn">保存</a>
		<a class="mini-button" iconCls="icon-close" onclick="CommonUtil.prototype.closeWindow()">关闭</a>
	</div>
    <script type="text/javascript">
    	mini.parse();
    	var tree = mini.get("tree");
    	var roleId;
    	
    	function setData(data) {
            data = mini.clone(data);
            roleId = data.id;
            tree.load("${pageContext.request.contextPath}/auth/roleAuth/queryRoleMenu.do?roleId=" + roleId);
        }
    	
    	function save(){
            CommonUtil.prototype.mask();
            $.ajax({
				url : "${pageContext.request.contextPath}/auth/roleAuth/saveRoleMenu.do?roleId=" + roleId,
				data : {keys: tree.getValue()},
				type : "POST",
				dataType : "json",
				success : function(data, textStatus, jqXHR) {
					CommonUtil.prototype.unmask();
					if(data.success){
						mini.alert("保存成功", "提醒", function(){
							CommonUtil.prototype.closeWindow('ignore');
						});
					}				
				}
			});	
    	}   	
	</script>
  </body>
</html>
